package com.tanhua.server.controller;

import com.tanhua.server.interceptor.UserHolder;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @author anshuai
 * @create 2021-02-04 16:32
 */
@RestController
@RequestMapping("/huanxin")
public class HuanXinController {

    /**
     * 此处简化设置，没有从数据库查
     * 获取用户的环信id和密码
     * GET /huanxin/user
     */
    @GetMapping("/user")
    public ResponseEntity getHuanXinUser(){
        HashMap<String, Object> result = new HashMap<>();
        result.put("username", UserHolder.getUserId().toString());
        result.put("password","123456");

        return ResponseEntity.ok(result);
    }
}
